import router from './index';

const whiteRoute = ['/login'];
router.beforeEach((to, from, next) => {
    if (!localStorage.getItem('token')) {
        if (whiteRoute.includes(to.path)) {
            next();
        } else {
            next('/login')
        }
    } else {
        next()
    }
})

export default router